﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using qna.Business;
using qna.Controls;
using qna.Services;
using qna.pages;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace qna.Controls
{
    public partial class CreateAnswer : System.Web.UI.UserControl
    {
        public Business.Answer a { get; set; }
        public int IDquestion { get; set; }
        public int IDuser { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void BtnPost_Click(object sender, EventArgs e)
        {
            AnswerService asc = new AnswerService();
            DateTime dt = DateTime.Now;

            if ((txtAnswer.Text != null && txtAnswer.Text != ""))
            {
                a = asc.InsertAns(txtAnswer.Text, IDquestion, IDuser, dt);
                new subscription().SendMail(IDquestion);
                Response.Redirect(Request.RawUrl);
            }
            else
            {
                Label1.Visible = true;
            }



        }
    }
}